package org.kernely.stream.service;


/**
 * Provides services about streams.
 */
public interface KernelyStreamService {
	
	/**
	 * Create new stream for a bundle.
	 * @param bundleClass The symbolic name of the bundle.
	 * @param category The title of the stream.
	 * @param uniqueId the unique id of the stream created.
	 */
	void createBundleStream(String bundleSymbolicName, String streamTitle, String uniqueId);

	/**
	 * Create new stream. To create bundle streams, use the createBundleStream method instead.
	 * @param title The title of the stream.
	 * @param category The category of the stream (use Stream class constants).
	 * @return the unique id of the stream.
	 */
	String createStream(String title, String category);

	/**
	 * Post a message on a bundle stream.
	 * @param uniqueId The id of the stream.
	 * @param title The title of the message.
	 * @param content The content of the message (max 140 chars).
	 */
	void postOnBundleStream(String uniqueId, String title, String content);

	/**
	 * Register a new filter which will be apply on each message posted
	 * @param filter : the new filter
	 */
	void registerStreamFilter(StreamFilter filter);
	
	/**
	 * Register a new filter at a specific priority which will be apply on each message posted
	 * @param filter the new filter
	 * @param priority : the priority (0 for the most important)
	 */
	void registerStreamFilter(StreamFilter filter, int priority);
	
	/**
	 * Apply all registered filters on the message
	 * @param message : the message to filter
	 * @return the result of the application of all filter
	 */
	String applyStreamFilters(String message);
}
